using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
using DTO;
using System.Data;

namespace HeThongDAO
{
    public class ChiTietPhieuNhapDAO
    {
        public static System.Data.DataTable DocSchema(string strQuery)
        {
            return Config.AccessHelper.Doc_Cau_Truc_HungPham(strQuery);
        }

        public static DataTable LayTatCaChiTietPhieuNhap()
        {
            string sql = "SELECT * FROM CHI_TIET_PHIEU_NHAP";
            return Config.AccessHelper.ExecuteQuery(sql);
        }

        public static bool ThemChiTietPhieuNhap(ChiTietPhieuNhapDTO ctpnDTO)
        {
            try
            {
                string sql = "INSERT INTO CHI_TIET_PHIEU_NHAP(MaPhieuNhap, MaSach, SoLuong, DonGiaNhap) ";
                sql += "VALUES(" + ctpnDTO.IMaPhieuNhap.ToString() + ",";
                sql += ctpnDTO.IMaSach.ToString() + ",";
                sql += ctpnDTO.ISoLuong.ToString() + ",";
                sql += ctpnDTO.IDonGia.ToString() + ")";

                Config.AccessHelper.ExecuteNonQuery(sql);

                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
